import { createSlice } from "@reduxjs/toolkit";

export const HomeSlice = createSlice({
  name: "HomeSlice",
  initialState: {
    start: "北京",
    end: "三亚",
    date: ""
  },
  reducers: {
    setStart(state, action) {
      state.start = action.payload;
    },
    setEnd(state, action) {
      state.end = action.payload;
    },
    setDate(state, action) {
      state.date = action.payload
    },

    resever(state) {
      [state.start, state.end] = [state.end, state.start];
    },
  },
});

export const { setStart, setEnd, resever, setDate } = HomeSlice.actions;
